using Microsoft.VisualStudio.TestTools.UnitTesting;
using RestUpMVC.Representation;
using RestUpMVC.Test.TestClasses;

namespace RestUpMVC.Test.Representation
{
    [TestClass]
    public class XmlRepresentationTest
    {
        [TestMethod]
        public void ContentType_ShouldReturnTheCorrectValue()
        {
            var resource = new {};
            var xml = new XmlRepresentation();

            Assert.AreEqual("application/xml", xml.ContentType, true);
        }

        [TestMethod]
        public void ConvertResource_ShouldReturnAnXmlStringRepresentationOfTheResource()
        {
            var resource = new TestResource {TheIdProperty = "foo"};
            var xml = new XmlRepresentation();
            xml.SetResource(resource);
            string representation = xml.ConvertResource();

            Assert.IsTrue(representation.Contains("<TheIdProperty>"));
        }
    }
}